package com.acmen.easyapi.model;

import com.acmen.easyapi.annotation.ReqParam;

/**
 * @author acmen
 */
public class PageQuery {
    @ReqParam(label = "页面大小")
    protected Integer pageSize = 20;
    @ReqParam(label = "页面编号")
    protected Integer pageNum = 1;


    public int getPageSize() {
        return pageSize;
    }

    public PageQuery setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
        return this;
    }

    public Integer getPageNum() {
        return pageNum;
    }

    public PageQuery setPageNum(Integer pageNum) {
        this.pageNum = pageNum;
        return this;
    }

    public int getOffset() {
        return pageNum > 0 ? (pageNum - 1) * pageSize : 0;
    }
}
